/*
 * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.iec.edp.caf.tenancy.api.service;

import io.iec.edp.caf.tenancy.api.entity.SuDbMapping;

import java.util.List;

public interface DbMappingService {

    public List<SuDbMapping> getAll(String appInstanceId);

    /**
     * 根据应用实例和服务单元获取连接映射信息
     *
     * @param appInstanceId 应用实例
     * @param su 服务单元标识
     * @return
     * @Date: 2019/8/21
     */
    public SuDbMapping get(String appInstanceId,String su);

    /**
     * 添加
     *
     * @param appInstanceId 应用实例
     * @param mappings 应用实例和服务单元获取连接映射信息
     * @return
     * @Date: 2019/8/21
     */
    public void add(String appInstanceId, List<SuDbMapping> mappings);

    /**
     * 更新租户信息
     *
     * @param appInstanceId 应用实例
     * @param mappings 应用实例和服务单元获取连接映射信息
     * @return
     * @Date: 2019/8/21
     */
    public boolean update(String appInstanceId, List<SuDbMapping> mappings);

    /**
     * 删除
     *
     * @param appInstanceId 应用实例
     * @return
     * @Date: 2019/8/21
     */
    public boolean removeByAppInstanceId(String appInstanceId);

    /**
     * 删除
     *
     * @Date: 2019/8/21
     */
    public boolean removeFromCache(String tenantId);

}
